home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2576 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: cs.vu.nl!sun4nl!xs4all!marketgraph!rvg
  2. From: rvg@marketgraph.xs4all.nl (Ruud van Gaal)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Problem with clock() with SAS 6.3
  5. Message-ID: <2720obf60.alamito@marketgraph.xs4all.nl>
  6. Date: Thu, 1 Feb 96 14:32:39 CET
  7. References: <4ej4kh$nkf@bs33n.staffs.ac.uk>
  8. Reply-To: rvg@marketgraph.xs4all.nl
  9. X-Newsreader: Alamito Mail and News Manager (V2.0.4 for Waffle) registered to MARKETGRAPH VISUAL AUTOMATION
  10.  
  11. In <4ej4kh$nkf@bs33n.staffs.ac.uk> cm4bctrd@bs47c.staffs.ac.uk (Wildfire) 
  12. wrote:
  13.  
  14. >But I'm getting screwy results.
  15. >Here's some sample code, and the output I get.
  16. >
  17. >#include <stdio.h>
  18. >#include <stdlib.h>
  19. >#include <time.h>
  20. >
  21. >int main()
  22. >{
  23. >    unsigned int
  24. >        loop;
  25. >    clock_t time;
  26. >    for( loop = 0 ; loop < 50 ; loop++ )
  27. >    {
  28. >        if( (clock_t) -1 == ( time = clock() ) )
  29. >        {
  30. >            printf( "%u. no time available.\n", loop );
  31. >        } else printf( "%u. %d\n", loop, (int)time );
  32. >        }
  33. >    }
  34. >
  35. >    return( EXIT_SUCCESS );
  36. >}
  37. >
  38. >And this is what I get...
  39. >
  40. >0. 2
  41. >1. 58
  42. >2. 134
  43. >3. 190
  44. >4. 262
  45. >5. 318
  46. >6. 395
  47. >7. 451
  48. >8. 4295491
  49. >9. 4295547
  50. >10. 4295619
  51. >11. 4295676
  52. >12. 4295748
  53. [..etc]
  54. >Anyways.  Can anyone help! =-)
  55.  
  56. Compiles & runs as expected on my SAS C >6.51<.
  57.  
  58. --
  59. Ruud van Gaal
  60. MarketGraph Visual Automation
  61. E-Mail                : rvg@marketgraph.xs4all.nl
  62. DoomShell 4.5 homepage: http://www.xs4all.nl/~jwkorver
  63. "...Works fascinates me. I could sit and watch it for hours..."
  64.  
  65.